<template>
	<view class="su-section">
		<!-- #ifdef H5 || MP -->
		<image class="su-launch" 
				src="/static/launch.png" 
				mode='widthFix'></image>
		<!-- #endif -->
	</view>
</template>

<script> 
	/**
	 * 程序启动页
	 * */
	export default { 
		data(){
			return {
				reloadNum:3 //自动登录次数
			}
		},
		onLoad() {
			this._loadPage();
		},
		methods:{ 
			_loadPage(){ 
				var bsessionid = uni.getStorageSync("bsessionid")
				var timeValue = 1200
				// #ifdef APP-PLUS
					timeValue = 10
				// #endif
				setTimeout(()=> {
					var autoLogin = uni.getStorageSync("_autoLogin")
					if(!autoLogin) return uni.core.toLogin()
					if (bsessionid) {
						uni.core.appInitial((flag,msg) => {
							if(flag){
								uni.switchTab({
									url: '/pages/tabbar/index/index'
								}) 
							}else {
								if(msg==="Data128" || msg==="101") {
									while(this.reloadNum--){
										this._loadPage()
									}
								}
							}
						});
					} else {
						uni.core.toLogin()
					}
				}, timeValue)
			}
		}
	};
</script>

<style>
page {
	background-color: #ffffff;
}
.su-section {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	display: flex;
}
.su-section .su-launch {
	width: 55%;	
	height:auto;
	margin-top: -300upx;
}
</style>
